<!-- 维修详情 》 处理弹窗 -->

<template>
  <WebModal path="deal" :small="!isAssign" :title="one.title">
    <WebForm path="deal">
      <MyAssign v-if="isAssign" />
      <MyReview v-if="isReview" />
      <MyRate v-if="isRate" />
      <MyCommon v-if="isCommon" />
    </WebForm>
  </WebModal>
</template>

<script>
// ============================== 导入依赖 ============================== //

import CORE from '@/CORE'

// ============================== 导出组件 ============================== //

export default {
  /**
   * 名称定义 (实际使用名称)
   */
  name: 'DealModal',

  /**
   * 混入列表 (配置选项合并)
   */
  mixins: [CORE.mixWeb('deal')],

  /**
   * 组件导入 (Abc.vue + Abc/index.vue)
   */
  ...CORE.components(require.context('./', true, /vue$/)),

  /**
   * 计算属性 (慎用箭头函数)
   */
  computed: {
    /**
     * 是否为指派
     */
    isAssign() {
      const { method } = this.one
      return ['assign', 'forward'].includes(method)
    },

    /**
     * 是否为审核
     */
    isReview() {
      const { method } = this.one
      return ['review', 'suspendReview'].includes(method)
    },

    /**
     * 是否为评价
     */
    isRate() {
      const { method } = this.one
      return method === 'evaluate'
    },

    /**
     * 是否为通用
     */
    isCommon() {
      const { method } = this.one
      return ['cancel', 'hasten', 'note', 'suspend'].includes(method)
    },
  },
}
</script>
